import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import spiders.zhihu.zhihu_answer_new_comment
import spiders.zhihu.zhihu_answer_voter
import settings
# os.environ['HTTPS_PROXY'] = 'http://singxle:mhhuiobs@122.114.168.245:16816'
# for i in os.environ.items():
#     print(i)
if __name__ == '__main__':
    pass
    completed = 2110
    offset = 10000
    limit = 10000
    spiders.zhihu.zhihu_answer_new_comment.WorkContext.PROXY_URL = '118.89.48.44:16816'
    spiders.zhihu.zhihu_answer_new_comment.WorkContext.MODULE_NAME = 'answer_comments_offset%slimit%s' % (10000, 10000)
    spiders.zhihu.zhihu_answer_new_comment.WorkContext.COOKIE_FILE = ['17187150644_login', '17096655720_login']
    spiders.zhihu.zhihu_answer_new_comment.WorkContext.PARTIAL_START_URL = '/comments?include=data%5B*%5D.author%2Ccollapsed%2Creply_to_author%2Cdisliked%2Ccontent%2Cvoting%2Cvote_count%2Cis_parent_author%2Cis_author&order=normal&status=open&limit=20&offset=0'
    spiders.zhihu.zhihu_answer_new_comment.WorkContext.TABLE_NAME = 'answer_comments_offset%slimit%s' % (10000, 10000)
    spiders.zhihu.zhihu_answer_new_comment.Workshop(bulk_size=10, offset=offset + completed, limit=limit - completed, worker_count=8).start_work()

    # spiders.zhihu.zhihu_answer_voter.WorkContext.PROXY_URL = ''
    # spiders.zhihu.zhihu_answer_voter.WorkContext.MODULE_NAME = 'answer_comments_offset%slimit%s' % (10000, 10000)
    # spiders.zhihu.zhihu_answer_voter.WorkContext.COOKIE_FILE = []
    # spiders.zhihu.zhihu_answer_voter.WorkContext.PARTIAL_START_URL = '/comments?include=data%5B*%5D.author%2Ccollapsed%2Creply_to_author%2Cdisliked%2Ccontent%2Cvoting%2Cvote_count%2Cis_parent_author%2Cis_author&order=normal&status=open&limit=20&offset=0'
    # spiders.zhihu.zhihu_answer_voter.WorkContext.TABLE_NAME = 'answer_comments_offset%slimit%s' % (0, 10000)
    # spiders.zhihu.zhihu_answer_voter.Workshop(bulk_size=100, offset=offset + completed, limit=limit - completed, worker_count=2).start_work()